import { Field, Int, ObjectType } from "@nestjs/graphql";
import { BaseEntity } from "../base.entity/base.entity";
import { Task } from "@prisma/client";
import { TaskItemEntity } from "../task.item.entity/task.item.entity";
import { UserOnTaskEntity } from "../user.on.task.entity/user.on.task.entity";
import { TaskOnClassesEntity } from "../task.on.classes.entity/task.on.classes.entity";
import { TaskCount } from "../count/task.count";

@ObjectType()
export class TaskEntity extends BaseEntity implements Task {
    @Field()
    title: string;

    @Field()
    status: boolean;

    @Field()
    select: string;

    @Field({ nullable: true })
    comment: string;

    @Field(() => [TaskItemEntity], { nullable: true })
    TaskItem?: TaskItemEntity[]

    @Field(() => [UserOnTaskEntity], { nullable: true })
    UserOnTask?: UserOnTaskEntity[]

    @Field(() => [TaskOnClassesEntity], { nullable: true })
    TaskOnClasses?: TaskOnClassesEntity[]

    @Field(() => Int, { nullable: true })
    finishedCount?: number

    @Field(() => Int, { nullable: true })
    userCount?: number

    @Field(() => Int, { nullable: true })
    teacherCount?: number

    @Field(() => Int, { nullable: true })
    total?: number

    @Field(() => TaskCount, { nullable: true })
    _count?: TaskCount
}


